/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.colegiatura.be.DetalleGuia;
import org.cip.esymons.colegiatura.be.GuiaRemision;

/**
 *
 * @author ADMINISTRADOR
 */
public class DetalleGuiaDelegate {

    private DetalleGuiaFacadeLocal local;

    public DetalleGuiaDelegate() {

        local = lookupDetalleGuiaFacade();
    }

    public void create(DetalleGuia detalleGuia){

        local.create(detalleGuia);
    }

    public void edit(DetalleGuia detalleGuia){

        local.edit(detalleGuia);
    }

    public void remove(DetalleGuia detalleGuia){

        local.remove(detalleGuia);
    }

    public DetalleGuia find(Object id){

        return local.find(id);
    }

    public List<DetalleGuia> findAll(){

        return local.findAll();
    }

    public List<DetalleGuia> listaPorGuia(GuiaRemision codigo){

        return local.listaPorGuia(codigo);
    }


    private DetalleGuiaFacadeLocal lookupDetalleGuiaFacade() {
        try {
            Context c = new InitialContext();
            return (DetalleGuiaFacadeLocal) c.lookup("java:comp/env/DetalleGuiaFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }



}
